

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>存储池 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />

  
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script>
        <script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/doctools.js"></script>
        <script src="../../../_static/sphinx_highlight.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../../genindex/" />
    <link rel="search" title="Search" href="../../../search/" />
    <link rel="next" title="纠删码" href="../erasure-code/" />
    <link rel="prev" title="数据归置概览" href="../data-placement/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../../" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="../../">Ceph 存储集群</a></li>
          <li class="breadcrumb-item"><a href="../">集群运维</a></li>
      <li class="breadcrumb-item active">存储池</li>
      <li class="wy-breadcrumbs-aside">
            <a href="../../../_sources/rados/operations/pools.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../../" class="icon icon-home"> Ceph
          

          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../start/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephadm/">Cephadm</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../">Ceph 存储集群</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../configuration/">配置</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../">运维</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../operating/">操纵集群</a></li>
<li class="toctree-l3"><a class="reference internal" href="../health-checks/">健康检查</a></li>
<li class="toctree-l3"><a class="reference internal" href="../monitoring/">监控集群</a></li>
<li class="toctree-l3"><a class="reference internal" href="../monitoring-osd-pg/">监控 OSD 和归置组</a></li>
<li class="toctree-l3"><a class="reference internal" href="../user-management/">用户管理</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pgcalc/">PG Calc</a></li>
<li class="toctree-l3"><a class="reference internal" href="../data-placement/">数据归置概览</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">存储池</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id3">存储池命名</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id4">列出存储池</a></li>
<li class="toctree-l4"><a class="reference internal" href="#createpool">创建存储池</a></li>
<li class="toctree-l4"><a class="reference internal" href="#associate-pool-to-application">关联存储池与应用程序</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id8">设置存储池配额</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id9">删除存储池</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id11">重命名存储池</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id12">查看存储池统计信息</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id13">给指定存储池拍快照</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id14">删除存储池快照</a></li>
<li class="toctree-l4"><a class="reference internal" href="#setpoolvalues">调整存储池选项值</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id17">获取存储池选项值</a></li>
<li class="toctree-l4"><a class="reference internal" href="#rados">设置 RADOS 对象副本数</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id18">获取对象副本数</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id19">管理加了 <code class="docutils literal notranslate"><span class="pre">--bulk</span></code> 标记的存储池</a></li>
<li class="toctree-l4"><a class="reference internal" href="#stretch">配置 stretch 存储池的值</a></li>
<li class="toctree-l4"><a class="reference internal" href="#setting-values-for-a-stretch-pool">取消给 stretch 存储池设置的值</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id21">显示一个 stretch 存储池设置的值</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../erasure-code/">纠删码</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cache-tiering/">分级缓存</a></li>
<li class="toctree-l3"><a class="reference internal" href="../placement-groups/">归置组</a></li>
<li class="toctree-l3"><a class="reference internal" href="../upmap/">使用 pg-upmap</a></li>
<li class="toctree-l3"><a class="reference internal" href="../read-balancer/">Operating the Read (Primary) Balancer</a></li>
<li class="toctree-l3"><a class="reference internal" href="../balancer/">均衡器模块</a></li>
<li class="toctree-l3"><a class="reference internal" href="../crush-map/">CRUSH 图</a></li>
<li class="toctree-l3"><a class="reference internal" href="../crush-map-edits/">手动编辑一个 CRUSH 图</a></li>
<li class="toctree-l3"><a class="reference internal" href="../stretch-mode/">Stretch Clusters</a></li>
<li class="toctree-l3"><a class="reference internal" href="../change-mon-elections/">Configuring Monitor Election Strategies</a></li>
<li class="toctree-l3"><a class="reference internal" href="../add-or-rm-osds/">增加/删除 OSD</a></li>
<li class="toctree-l3"><a class="reference internal" href="../add-or-rm-mons/">增加/删除监视器</a></li>
<li class="toctree-l3"><a class="reference internal" href="../devices/">设备管理</a></li>
<li class="toctree-l3"><a class="reference internal" href="../bluestore-migration/">迁移到 BlueStore</a></li>
<li class="toctree-l3"><a class="reference internal" href="../control/">命令参考</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/community/">Ceph 社区</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/troubleshooting-mon/">监视器故障排除</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/troubleshooting-osd/">OSD 故障排除</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/troubleshooting-pg/">归置组排障</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/log-and-debug/">日志记录和调试</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/cpu-profiling/">CPU 剖析</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/memory-profiling/">内存剖析</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../man/">    手册页</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../troubleshooting/">故障排除</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../api/">APIs</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../monitoring/">监控概览</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../hardware-monitoring/">硬件监控</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <section id="rados-pools">
<span id="id1"></span><h1>存储池<a class="headerlink" href="#rados-pools" title="Permalink to this heading"></a></h1>
<p>存储池是存储对象时的逻辑分区。</p>
<p>存储池提供的功能：</p>
<ul>
<li><p><strong>自恢复力（ Resilience ）：</strong> 你可以设置在不丢数据的前提下允许多少 OSD 失效，
如果你的集群用的是多副本存储池，在不丢失数据的前提下，
可以失效的 OSD 数量等于副本数。</p>
<p>例如：典型配置是存储一个对象和两个 RADOS 对象副本
（即 <code class="docutils literal notranslate"><span class="pre">size</span> <span class="pre">=</span> <span class="pre">3</span></code> ），但你可以单独配置每个存储池的副本数；
对<a class="reference external" href="../erasure-code">纠删码存储池</a>来说，
自恢复力的定义是编码块数
（例如，默认<strong>纠删码配置</strong>里的 <code class="docutils literal notranslate"><span class="pre">m=2</span></code> ）。</p>
</li>
<li><p><strong>归置组：</strong> <a class="reference internal" href="../placement-groups/#pg-autoscaler"><span class="std std-ref">autoscaler</span></a>
会设置存储池的归置组（ PG ）数量。
典型配置中，目标 PG 数是每个 OSD 大约 150 个，
这样，不用过多计算资源就能得到较优的均衡。
配置了多个存储池时，要整体考虑到各个存储池和整个集群的归置组数量都要合理。
每个 PG 都属于一个特定的存储池，所以多个存储池共用一些相同的 OSD 时，
要确保每个 OSD 上 PG 数的 <strong>总和</strong> 在每 OSD 的 PG 数（ PG-per-OSD ）目标范围内。
想了解如何手动设置每个存储池的归置组数量，
看 <a class="reference internal" href="../placement-groups/#setting-the-number-of-placement-groups"><span class="std std-ref">设置归置组数量</span></a> ，
（没有采用 autoscaler 时才需要这个步骤）。</p></li>
<li><p><strong>CRUSH 规则：</strong> 当你往存储池里存数据的时候，
此集群内对象及其副本（或纠删码存储池里的数据块）的归置由 CRUSH 规则控制。如果默认规则不符合你的使用情形，
你可以给自己的存储池定制 CRUSH 规则。</p></li>
<li><p><strong>快照：</strong> 用 <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">osd</span> <span class="pre">pool</span> <span class="pre">mksnap</span></code> 创建快照的时候，
实际上创建了某一特定存储池的快照。</p></li>
</ul>
<section id="id3">
<h2>存储池命名<a class="headerlink" href="#id3" title="Permalink to this heading"></a></h2>
<p>以 <code class="docutils literal notranslate"><span class="pre">.</span></code> 打头的存储池名字是为 Ceph 内部操作保留的，
请不要创建或修改这样的存储池。</p>
</section>
<section id="id4">
<h2>列出存储池<a class="headerlink" href="#id4" title="Permalink to this heading"></a></h2>
<p>有多种方法获取集群存储池列表。</p>
<p>只罗列集群的存储池名字（写脚本方便），执行：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><style type="text/css">
span.prompt1:before {
  content: "$ ";
}
</style><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>ls</span>
</pre></div></div><div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">.</span><span class="n">rgw</span><span class="o">.</span><span class="n">root</span>
<span class="n">default</span><span class="o">.</span><span class="n">rgw</span><span class="o">.</span><span class="n">log</span>
<span class="n">default</span><span class="o">.</span><span class="n">rgw</span><span class="o">.</span><span class="n">control</span>
<span class="n">default</span><span class="o">.</span><span class="n">rgw</span><span class="o">.</span><span class="n">meta</span>
</pre></div>
</div>
<p>要罗列集群存储池时带上它的编号，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>lspools</span>
</pre></div></div><div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="mi">1</span> <span class="o">.</span><span class="n">rgw</span><span class="o">.</span><span class="n">root</span>
<span class="mi">2</span> <span class="n">default</span><span class="o">.</span><span class="n">rgw</span><span class="o">.</span><span class="n">log</span>
<span class="mi">3</span> <span class="n">default</span><span class="o">.</span><span class="n">rgw</span><span class="o">.</span><span class="n">control</span>
<span class="mi">4</span> <span class="n">default</span><span class="o">.</span><span class="n">rgw</span><span class="o">.</span><span class="n">meta</span>
</pre></div>
</div>
<p>要罗列集群存储池的额外信息，执行：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>ls<span class="w"> </span>detail</span>
</pre></div></div><div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pool</span> <span class="mi">1</span> <span class="s1">&#39;.rgw.root&#39;</span> <span class="n">replicated</span> <span class="n">size</span> <span class="mi">3</span> <span class="n">min_size</span> <span class="mi">1</span> <span class="n">crush_rule</span> <span class="mi">0</span> <span class="n">object_hash</span> <span class="n">rjenkins</span> <span class="n">pg_num</span> <span class="mi">1</span> <span class="n">pgp_num</span> <span class="mi">1</span> <span class="n">autoscale_mode</span> <span class="n">on</span> <span class="n">last_change</span> <span class="mi">19</span> <span class="n">flags</span> <span class="n">hashpspool</span> <span class="n">stripe_width</span> <span class="mi">0</span> <span class="n">application</span> <span class="n">rgw</span> <span class="n">read_balance_score</span> <span class="mf">4.00</span>
<span class="n">pool</span> <span class="mi">2</span> <span class="s1">&#39;default.rgw.log&#39;</span> <span class="n">replicated</span> <span class="n">size</span> <span class="mi">3</span> <span class="n">min_size</span> <span class="mi">1</span> <span class="n">crush_rule</span> <span class="mi">0</span> <span class="n">object_hash</span> <span class="n">rjenkins</span> <span class="n">pg_num</span> <span class="mi">1</span> <span class="n">pgp_num</span> <span class="mi">1</span> <span class="n">autoscale_mode</span> <span class="n">on</span> <span class="n">last_change</span> <span class="mi">21</span> <span class="n">flags</span> <span class="n">hashpspool</span> <span class="n">stripe_width</span> <span class="mi">0</span> <span class="n">application</span> <span class="n">rgw</span> <span class="n">read_balance_score</span> <span class="mf">4.00</span>
<span class="n">pool</span> <span class="mi">3</span> <span class="s1">&#39;default.rgw.control&#39;</span> <span class="n">replicated</span> <span class="n">size</span> <span class="mi">3</span> <span class="n">min_size</span> <span class="mi">1</span> <span class="n">crush_rule</span> <span class="mi">0</span> <span class="n">object_hash</span> <span class="n">rjenkins</span> <span class="n">pg_num</span> <span class="mi">1</span> <span class="n">pgp_num</span> <span class="mi">1</span> <span class="n">autoscale_mode</span> <span class="n">on</span> <span class="n">last_change</span> <span class="mi">23</span> <span class="n">flags</span> <span class="n">hashpspool</span> <span class="n">stripe_width</span> <span class="mi">0</span> <span class="n">application</span> <span class="n">rgw</span> <span class="n">read_balance_score</span> <span class="mf">4.00</span>
<span class="n">pool</span> <span class="mi">4</span> <span class="s1">&#39;default.rgw.meta&#39;</span> <span class="n">replicated</span> <span class="n">size</span> <span class="mi">3</span> <span class="n">min_size</span> <span class="mi">1</span> <span class="n">crush_rule</span> <span class="mi">0</span> <span class="n">object_hash</span> <span class="n">rjenkins</span> <span class="n">pg_num</span> <span class="mi">1</span> <span class="n">pgp_num</span> <span class="mi">1</span> <span class="n">autoscale_mode</span> <span class="n">on</span> <span class="n">last_change</span> <span class="mi">25</span> <span class="n">flags</span> <span class="n">hashpspool</span> <span class="n">stripe_width</span> <span class="mi">0</span> <span class="n">pg_autoscale_bias</span> <span class="mi">4</span> <span class="n">application</span> <span class="n">rgw</span> <span class="n">read_balance_score</span> <span class="mf">4.00</span>
</pre></div>
</div>
<p>要查看更多信息，执行此命令时可以加上 <code class="docutils literal notranslate"><span class="pre">--format</span></code> （或 <code class="docutils literal notranslate"><span class="pre">-f</span></code> ）选项，
还有它的值 <code class="docutils literal notranslate"><span class="pre">json</span></code> 、 <code class="docutils literal notranslate"><span class="pre">json-pretty</span></code> 、 <code class="docutils literal notranslate"><span class="pre">xml</span></code> 或 <code class="docutils literal notranslate"><span class="pre">xml-pretty</span></code> 。</p>
</section>
<section id="createpool">
<span id="id5"></span><h2>创建存储池<a class="headerlink" href="#createpool" title="Permalink to this heading"></a></h2>
<p>创建存储池前先看看<a class="reference external" href="../../configuration/pool-pg-config-ref">存储池、归置组和 CRUSH 配置参考</a>。
放在监视器集群里的 Ceph 中央配置数据库，里面有个配置选项（名为 <code class="docutils literal notranslate"><span class="pre">pg_num</span></code> ），
用于决定每个存储池的 PG 数量，在创建存储池、
却没给它单独指定 PG 数时就用这个值。这个值的默认数值可以更改。
关于每个存储池的归置组数量，见<a class="reference external" href="../placement-groups#set-the-number-of-placement-groups">设置归置组数量</a>。</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>从 Luminous 版起，所有存储池都需要与使用它们的应用程序关联。
详情见<a class="reference internal" href="#id7">关联存储池与应用程序</a>。</p>
</div>
<p>要创建一个存储池，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>create<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span><span class="w"> </span><span class="o">[{</span>pg-num<span class="o">}</span><span class="w"> </span><span class="o">[{</span>pgp-num<span class="o">}]]</span><span class="w"> </span><span class="o">[</span>replicated<span class="o">]</span><span class="w"> </span><span class="se">\</span>
<span class="w">         </span><span class="o">[</span>crush-rule-name<span class="o">]</span><span class="w"> </span><span class="o">[</span>expected-num-objects<span class="o">]</span></span>
</pre></div></div><p>或者：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>create<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span><span class="w"> </span><span class="o">[{</span>pg-num<span class="o">}</span><span class="w"> </span><span class="o">[{</span>pgp-num<span class="o">}]]</span><span class="w">   </span>erasure<span class="w"> </span><span class="se">\</span>
<span class="w">         </span><span class="o">[</span>erasure-code-profile<span class="o">]</span><span class="w"> </span><span class="o">[</span>crush-rule-name<span class="o">]</span><span class="w"> </span><span class="o">[</span>expected_num_objects<span class="o">]</span><span class="w"> </span><span class="o">[</span>--autoscale-mode<span class="o">=</span>&lt;on,off,warn&gt;<span class="o">]</span></span>
</pre></div></div><p>上述命令里各元素的简要描述，见下文：</p>
<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">{pool-name}</span></span></dt>
<dd><p>存储池名称，必须唯一。</p>
<dl class="field-list simple">
<dt class="field-odd">类型<span class="colon">:</span></dt>
<dd class="field-odd"><p>String</p>
</dd>
<dt class="field-even">是否必需<span class="colon">:</span></dt>
<dd class="field-even"><p>必需。</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">{pg-num}</span></span></dt>
<dd><p>存储池拥有的归置组总数。
关于如何计算合适的数值，参见<a class="reference internal" href="../placement-groups/#id1"><span class="std std-ref">归置组</span></a>。
默认值 <code class="docutils literal notranslate"><span class="pre">8</span></code> 对大多数系统都 <strong>不合适</strong> 。</p>
<dl class="field-list simple">
<dt class="field-odd">类型<span class="colon">:</span></dt>
<dd class="field-odd"><p>整数</p>
</dd>
<dt class="field-even">是否必需<span class="colon">:</span></dt>
<dd class="field-even"><p>Yes</p>
</dd>
<dt class="field-odd">默认值<span class="colon">:</span></dt>
<dd class="field-odd"><p>8</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">{pgp-num}</span></span></dt>
<dd><p>用于归置的 PG 总数。此值<strong>应该等于 PG 总数</strong>，
除非是 <code class="docutils literal notranslate"><span class="pre">pg_num</span></code> 正在增加或减少时的短暂期间。
注意，从 Nautilus 版起，一般不会直接更改 <code class="docutils literal notranslate"><span class="pre">pgp_num</span></code> ：
存储池的 <code class="docutils literal notranslate"><span class="pre">pg_num</span></code> 被更改后， Ceph 会自动伸缩这个存储池的 <code class="docutils literal notranslate"><span class="pre">pgp_num</span></code> 。
<code class="docutils literal notranslate"><span class="pre">pg_num</span></code> 的调整可以是 PG autoscaler 做出的；
如果某个存储池的 autoscaler 被禁用了，
还可以通过 CLI 或 仪表盘手动设置。</p>
<dl class="field-list simple">
<dt class="field-odd">类型<span class="colon">:</span></dt>
<dd class="field-odd"><p>整数</p>
</dd>
<dt class="field-even">是否必需<span class="colon">:</span></dt>
<dd class="field-even"><p>是的。命令行中没指定的话读取默认值（除非 Ceph 配置文件里另外配置了值）。</p>
</dd>
<dt class="field-odd">默认值<span class="colon">:</span></dt>
<dd class="field-odd"><p>8</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">{replicated|erasure}</span></span></dt>
<dd><p>存储池的数据保护策略，可以是<code class="docutils literal notranslate"><span class="pre">replicated</span></code>
（多副本，像 RAID1 和 RAID10 ）、
<code class="docutils literal notranslate"><span class="pre">erasure</span></code> （纠删，一种<a class="reference external" href="../erasure-code">通用奇偶校验 RAID</a> 策略，类似 RAID6 但更加灵活）。
<code class="docutils literal notranslate"><span class="pre">replicated</span></code> 在给定的原始存储空间中产生的可用容量较少，
但可以适用所有 Ceph 组件和使用案例；
<code class="docutils literal notranslate"><span class="pre">erasure</span></code> (EC) 在给定的原始存储空间中产生的可用容量比多副本存储池更多，
但只能适用部分 Ceph 组件和使用案例。
根据载荷与特定配置的不同， EC 通常需要比多副本存储池更多的故障域，
并且性能还是降级的，但它可以容许更多的驱动器重叠、
或主机故障。</p>
<dl class="field-list simple">
<dt class="field-odd">类型<span class="colon">:</span></dt>
<dd class="field-odd"><p>String</p>
</dd>
<dt class="field-even">是否必需<span class="colon">:</span></dt>
<dd class="field-even"><p>No.</p>
</dd>
<dt class="field-odd">默认值<span class="colon">:</span></dt>
<dd class="field-odd"><p>replicated</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">[crush-rule-name]</span></span></dt>
<dd><p>此存储池所用的 CRUSH 规则名字。
指定的规则必须是已经存在的，否则此命令会失败。</p>
<dl class="field-list simple">
<dt class="field-odd">类型<span class="colon">:</span></dt>
<dd class="field-odd"><p>String</p>
</dd>
<dt class="field-even">是否必需<span class="colon">:</span></dt>
<dd class="field-even"><p>No.</p>
</dd>
<dt class="field-odd">默认值<span class="colon">:</span></dt>
<dd class="field-odd"><p>对于多副本存储池（ <strong>replicated pool</strong> ）来说，其规则由
<a class="reference internal" href="../../configuration/pool-pg-config-ref/#confval-osd_pool_default_crush_rule"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_pool_default_crush_rule</span></code></a> 配置指定，此规则必须存在。
对于纠删码存储池（ <strong>erasure pool</strong> ）来说，
如果用的是 <code class="docutils literal notranslate"><span class="pre">default</span></code> <a class="reference external" href="../erasure-code-profile">纠删码配置</a>那就是 <code class="docutils literal notranslate"><span class="pre">erasure-code</span></code> ，
否则就是 <code class="docutils literal notranslate"><span class="pre">{pool-name}</span></code> 。如果此规则不存在，会悄悄地创建。</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">[erasure-code-profile=profile]</span></span></dt>
<dd><p>仅适用于<strong>纠删</strong>存储池。让 Ceph 采用指定的<a class="reference external" href="../erasure-code-profile">纠删码配置</a>。
此配置必须是已经存在的配置，通过仪表盘定义、
或调用 <code class="docutils literal notranslate"><span class="pre">osd</span> <span class="pre">erasure-code-profile</span> <span class="pre">set</span></code> 定义的。
注意，在存储池创建以后，对其 EC 配置的更改<em>不会</em>生效。
要更改现有存储池的 EC 配置，必须更改存储池，
让它使用另外一个按需要定义好的 CRUSH 规则。</p>
<dl class="field-list simple">
<dt class="field-odd">类型<span class="colon">:</span></dt>
<dd class="field-odd"><p>String</p>
</dd>
<dt class="field-even">是否必需<span class="colon">:</span></dt>
<dd class="field-even"><p>No.</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">--autoscale-mode=&lt;on,off,warn&gt;</span></span></dt>
<dd><ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">on</span></code>: Ceph 集群会根据存储池里 PG 数的实际使用情况自动调整、或给出更改建议。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">warn</span></code>: Ceph 集群会根据存储池里 PG 数的实际使用情况自动调整、或给出更改建议。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">off</span></code>: 详情参考 <a class="reference internal" href="../placement-groups/#id1"><span class="std std-ref">归置组</span></a>。</p></li>
</ul>
<dl class="field-list simple">
<dt class="field-odd">类型<span class="colon">:</span></dt>
<dd class="field-odd"><p>String</p>
</dd>
<dt class="field-even">是否必需<span class="colon">:</span></dt>
<dd class="field-even"><p>No.</p>
</dd>
<dt class="field-odd">默认值<span class="colon">:</span></dt>
<dd class="field-odd"><p>默认行为由 <a class="reference internal" href="../../configuration/pool-pg-config-ref/#confval-osd_pool_default_pg_autoscale_mode"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_pool_default_pg_autoscale_mode</span></code></a> 选项控制。</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">[expected-num-objects]</span></span></dt>
<dd><p>为这个存储池预估的对象数。设置此值（要同时把 <strong>filestore merge threshold</strong>
设置为负数）后，在创建存储池时就会拆分 PG 文件夹，
以免运行时拆分文件夹导致延时增大。</p>
<dl class="field-list simple">
<dt class="field-odd">类型<span class="colon">:</span></dt>
<dd class="field-odd"><p>Integer</p>
</dd>
<dt class="field-even">是否必需<span class="colon">:</span></dt>
<dd class="field-even"><p>No.</p>
</dd>
<dt class="field-odd">默认值<span class="colon">:</span></dt>
<dd class="field-odd"><p>0 ，创建存储池时不拆分目录。</p>
</dd>
</dl>
</dd></dl>

</section>
<section id="associate-pool-to-application">
<span id="id7"></span><h2>关联存储池与应用程序<a class="headerlink" href="#associate-pool-to-application" title="Permalink to this heading"></a></h2>
<p>存储池要先与应用程序关联才能使用。要用于 CephFS 的存储池、
或由 RGW 创建的存储池已经自动关联过了；计划用于 RBD 的存储池应该用 <code class="docutils literal notranslate"><span class="pre">rbd</span></code> 工具初始化（详情见<a class="reference external" href="../../../rbd/rados-rbd-cmds/#create-a-block-device-pool">块设备命令</a>）。</p>
<p>对于其它案例，你可以手动关联存储池与应用程序名字（格式自由），执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>application<span class="w"> </span><span class="nb">enable</span><span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span><span class="w"> </span><span class="o">{</span>application-name<span class="o">}</span></span>
</pre></div></div><div class="admonition note">
<p class="admonition-title">Note</p>
<p>CephFS 的应用程序名字是 <code class="docutils literal notranslate"><span class="pre">cephfs</span></code> ； RBD 的应用程序名字是 <code class="docutils literal notranslate"><span class="pre">rbd</span></code> ， RGW 的应用程序名字是 <code class="docutils literal notranslate"><span class="pre">rgw</span></code> 。</p>
</div>
</section>
<section id="id8">
<h2>设置存储池配额<a class="headerlink" href="#id8" title="Permalink to this heading"></a></h2>
<p>存储池配额可设置最大字节数、和/或每存储池最大对象数。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>set-quota<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span><span class="w"> </span><span class="o">[</span>max_objects<span class="w"> </span><span class="o">{</span>obj-count<span class="o">}]</span><span class="w"> </span><span class="o">[</span>max_bytes<span class="w"> </span><span class="o">{</span>bytes<span class="o">}]</span></span>
</pre></div></div><p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>set-quota<span class="w"> </span>data<span class="w"> </span>max_objects<span class="w"> </span><span class="m">10000</span></span>
</pre></div></div><p>要取消配额，把此数值设置为 <code class="docutils literal notranslate"><span class="pre">0</span></code> 。注意，设置配额时，
可以只设置字节数、或只设置 RADOS 对象数，或者二者都设置。</p>
</section>
<section id="id9">
<h2>删除存储池<a class="headerlink" href="#id9" title="Permalink to this heading"></a></h2>
<p>要删除一存储池，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>delete<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span><span class="w"> </span><span class="o">[{</span>pool-name<span class="o">}</span><span class="w"> </span>--yes-i-really-really-mean-it<span class="o">]</span></span>
</pre></div></div><p>要删除存储池，中央配置的 <code class="docutils literal notranslate"><span class="pre">mon_allow_pool_delete</span></code> 标志必须设置为 <code class="docutils literal notranslate"><span class="pre">true</span></code> ，
否则监视器们会拒绝删除存储池。</p>
<p>详情见<a class="reference external" href="../../configuration/mon-config-ref">监视器配置</a>。</p>
<p>如果有给存储池创建的自定义规则，应该删掉它们。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>get<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span><span class="w"> </span>crush_rule</span>
</pre></div></div><p>例如，假设规则 id 为 123 ，检查所有存储池，看它们是否在用此规则，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>dump<span class="w"> </span><span class="p">|</span><span class="w"> </span>grep<span class="w"> </span><span class="s2">&quot;^pool&quot;</span><span class="w"> </span><span class="p">|</span><span class="w"> </span>grep<span class="w"> </span><span class="s2">&quot;crush_rule 123&quot;</span></span>
</pre></div></div><p>如果没有别的存储池使用这个定制规则，那就可以安全地从集群里删掉它。</p>
<p>同样地，如果有用户及其权限与存储池绑死了，但如今这些存储池已不存在，
最好也删除那些用户，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>auth<span class="w"> </span>ls<span class="w"> </span><span class="p">|</span><span class="w"> </span>grep<span class="w"> </span>-C<span class="w"> </span><span class="m">5</span><span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span></span>
<span class="prompt1">ceph<span class="w"> </span>auth<span class="w"> </span>del<span class="w"> </span><span class="o">{</span>user<span class="o">}</span></span>
</pre></div></div></section>
<section id="id11">
<h2>重命名存储池<a class="headerlink" href="#id11" title="Permalink to this heading"></a></h2>
<p>要重命名一个存储池，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>rename<span class="w"> </span><span class="o">{</span>current-pool-name<span class="o">}</span><span class="w"> </span><span class="o">{</span>new-pool-name<span class="o">}</span></span>
</pre></div></div><p>如果重命名了一个存储池，而它之前的认证用户有每存储池能力，
那你必须用新存储池名字更新这个用户的能力（即 caps ）。</p>
</section>
<section id="id12">
<h2>查看存储池统计信息<a class="headerlink" href="#id12" title="Permalink to this heading"></a></h2>
<p>要查看某存储池的利用率统计信息，执行下列命令:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">rados<span class="w"> </span>df</span>
</pre></div></div><p>要获取某个指定的或所有存储池的 I/O 信息，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>stats<span class="w"> </span><span class="o">[{</span>pool-name<span class="o">}]</span></span>
</pre></div></div></section>
<section id="id13">
<h2>给指定存储池拍快照<a class="headerlink" href="#id13" title="Permalink to this heading"></a></h2>
<p>要拍下某存储池的快照，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>mksnap<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span><span class="w"> </span><span class="o">{</span>snap-name<span class="o">}</span></span>
</pre></div></div></section>
<section id="id14">
<h2>删除存储池快照<a class="headerlink" href="#id14" title="Permalink to this heading"></a></h2>
<p>要删除某存储池的一个快照，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>rmsnap<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span><span class="w"> </span><span class="o">{</span>snap-name<span class="o">}</span></span>
</pre></div></div></section>
<section id="setpoolvalues">
<span id="id15"></span><h2>调整存储池选项值<a class="headerlink" href="#setpoolvalues" title="Permalink to this heading"></a></h2>
<p>要设置一个存储池的配置选项值，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span><span class="nb">set</span><span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span><span class="w"> </span><span class="o">{</span>key<span class="o">}</span><span class="w"> </span><span class="o">{</span>value<span class="o">}</span></span>
</pre></div></div><p>你可以设置下列键的值：</p>
<span class="target" id="compression-algorithm"></span><dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">compression_algorithm</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>设置向底层 BlueStore 后端存储数据时所用的内联压缩算法。
此选项会覆盖全局配置 <a class="reference internal" href="../../configuration/bluestore-config-ref/#confval-bluestore_compression_algorithm"><code class="xref std std-confval docutils literal notranslate"><span class="pre">bluestore_compression_algorithm</span></code></a> 。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>String</p>
</dd>
<dt class="field-odd">有效选项<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">lz4</span></code>, <code class="docutils literal notranslate"><span class="pre">snappy</span></code>, <code class="docutils literal notranslate"><span class="pre">zlib</span></code>, <code class="docutils literal notranslate"><span class="pre">zstd</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">compression_mode</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>设置向底层 BlueStore 后端存储数据时所用内联压缩算法的策略。
此选项会覆盖全局配置 <a class="reference internal" href="../../configuration/bluestore-config-ref/#confval-bluestore_compression_mode"><code class="xref std std-confval docutils literal notranslate"><span class="pre">bluestore_compression_mode</span></code></a> 。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>String</p>
</dd>
<dt class="field-odd">有效选项<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">none</span></code>, <code class="docutils literal notranslate"><span class="pre">passive</span></code>, <code class="docutils literal notranslate"><span class="pre">aggressive</span></code>, <code class="docutils literal notranslate"><span class="pre">force</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">compression_min_blob_size</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>设置可压缩数据块的最小尺寸：小于此值的数据块不会被压缩。
此设置会覆盖下列全局配置：</p>
</dd>
</dl>
<ul class="simple">
<li><p><a class="reference internal" href="../../configuration/bluestore-config-ref/#confval-bluestore_compression_min_blob_size"><code class="xref std std-confval docutils literal notranslate"><span class="pre">bluestore_compression_min_blob_size</span></code></a></p></li>
<li><p><a class="reference internal" href="../../configuration/bluestore-config-ref/#confval-bluestore_compression_min_blob_size_hdd"><code class="xref std std-confval docutils literal notranslate"><span class="pre">bluestore_compression_min_blob_size_hdd</span></code></a></p></li>
<li><p><a class="reference internal" href="../../configuration/bluestore-config-ref/#confval-bluestore_compression_min_blob_size_ssd"><code class="xref std std-confval docutils literal notranslate"><span class="pre">bluestore_compression_min_blob_size_ssd</span></code></a></p></li>
</ul>
<dl class="field-list simple">
<dt class="field-odd">类型<span class="colon">:</span></dt>
<dd class="field-odd"><p>Unsigned Integer</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">compression_max_blob_size</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>设置数据块的最大尺寸：大于此数值的数据块在压缩前会破碎成尺寸为
<code class="docutils literal notranslate"><span class="pre">compression_max_blob_size</span></code> 的较小二进制块（ blob ）。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>Unsigned Integer</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="size"></span><dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">size</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>设置存储池中的对象副本数，详情见<a class="reference internal" href="#rados">设置 RADOS 对象副本数</a>。
仅适用于多副本存储池。 EC 存储池<strong>回应</strong>的 <code class="docutils literal notranslate"><span class="pre">size</span></code> 数值等于 K+M ，
但不能这样直接<strong>设置</strong>这个数值。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>整数</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="min-size"></span><dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">min_size</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>为保证 PG 活跃且能处理 I/O 操作，要求设置的最小活跃副本数（或分片数），
详情见<a class="reference internal" href="#rados">设置 RADOS 对象副本数</a> 。对于纠删码存储池，此值应该设置成大于 <code class="docutils literal notranslate"><span class="pre">K</span></code> 的值。
如果只有 <code class="docutils literal notranslate"><span class="pre">K</span></code> 个分片的时候仍然允许 I/O ，那将没有冗余，并且在遇到另外一件永久 OSD 故障这样的事件时，数据会丢失。更多信息见<a class="reference external" href="../erasure-code">纠删码</a> 。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>整数</p>
</dd>
<dt class="field-odd">适用版本<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">0.54</span></code> 及以上。</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="pg-num"></span><dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">pg_num</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>指定存储池的 PG 总数。注意 PG autoscaler ，
如果在指定存储池上启用了，可能会覆盖手动分配的数值。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>整数</p>
</dd>
<dt class="field-odd">有效范围<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">0</span></code> 到 <code class="docutils literal notranslate"><span class="pre">mon_max_pool_pg_num</span></code> 。如果设置为 <code class="docutils literal notranslate"><span class="pre">0</span></code> ，将采用 <code class="docutils literal notranslate"><span class="pre">osd_pool_default_pg_num</span></code> 的值。</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="pgp-num"></span><dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">pgp_num</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>计算数据归置时使用的、用于归置的有效归置组数量。使用 Nautilus 及以上版本时，
管理员一般无需明确设置此值， Ceph 会自动递增或递减此值，以匹配 <code class="docutils literal notranslate"><span class="pre">pg_num</span></code> 。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>整数</p>
</dd>
<dt class="field-odd">有效范围<span class="colon">:</span></dt>
<dd class="field-odd"><p>在 <code class="docutils literal notranslate"><span class="pre">1</span></code> 和 <code class="docutils literal notranslate"><span class="pre">pg_num</span></code> 的当前数值之间。</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="crush-rule"></span><dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">crush_rule</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>设置 CRUSH 规则， Ceph 用它把存储池对象映射到正确的 OSD 。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>String</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="allow-ec-overwrites"></span><dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">allow_ec_overwrites</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>写入一个纠删码存储池时是否允许只更新 RADOS 对象的部分数据，打开后
CephFS 和 RBD 才能用 EC （erasure-coded ，纠删码）存储池存储用户数据
（但不能用于元数据）。详情见<a class="reference external" href="../erasure-code#erasure-coding-with-overwrites">带重写功能的纠删码编码</a>。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>Boolean</p>
</dd>
</dl>
<div class="versionadded">
<p><span class="versionmodified added">New in version 12.2.0.</span></p>
</div>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">hashpspool</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>给指定存储池设置/取消 <code class="docutils literal notranslate"><span class="pre">HASHPSPOOL</span></code> 标志。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>整数</p>
</dd>
<dt class="field-odd">有效范围<span class="colon">:</span></dt>
<dd class="field-odd"><p>1 开启， 0 取消</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="nodelete"></span><dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">nodelete</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>给指定存储池设置/取消 <code class="docutils literal notranslate"><span class="pre">NODELETE</span></code> 标志。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>整数</p>
</dd>
<dt class="field-odd">有效范围<span class="colon">:</span></dt>
<dd class="field-odd"><p>1 开启， 0 取消</p>
</dd>
<dt class="field-even">适用版本<span class="colon">:</span></dt>
<dd class="field-even"><p>Version <code class="docutils literal notranslate"><span class="pre">FIXME</span></code></p>
</dd>
</dl>
</dd></dl>

<span class="target" id="nopgchange"></span><dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">nopgchange</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>给指定存储池设置/取消 <code class="docutils literal notranslate"><span class="pre">NOPGCHANGE</span></code> 标志。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>整数</p>
</dd>
<dt class="field-odd">有效范围<span class="colon">:</span></dt>
<dd class="field-odd"><p>1 开启， 0 取消</p>
</dd>
<dt class="field-even">适用版本<span class="colon">:</span></dt>
<dd class="field-even"><p>Version <code class="docutils literal notranslate"><span class="pre">FIXME</span></code></p>
</dd>
</dl>
</dd></dl>

<span class="target" id="nosizechange"></span><dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">nosizechange</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>给指定存储池设置/取消 <code class="docutils literal notranslate"><span class="pre">NOSIZECHANGE</span></code> 标志。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>整数</p>
</dd>
<dt class="field-odd">有效范围<span class="colon">:</span></dt>
<dd class="field-odd"><p>1 开启， 0 取消</p>
</dd>
<dt class="field-even">适用版本<span class="colon">:</span></dt>
<dd class="field-even"><p>Version <code class="docutils literal notranslate"><span class="pre">FIXME</span></code></p>
</dd>
</dl>
</dd></dl>

<span class="target" id="bulk"></span><dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">bulk</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>设置、取消指定存储池的 <code class="docutils literal notranslate"><span class="pre">BULK</span></code> 标志。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>Boolean</p>
</dd>
<dt class="field-odd">有效范围<span class="colon">:</span></dt>
<dd class="field-odd"><p>true/1 设置标志， false/0 取消标志</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="write-fadvise-dontneed"></span><dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">write_fadvise_dontneed</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>设置或取消指定存储池的 <code class="docutils literal notranslate"><span class="pre">WRITE_FADVISE_DONTNEED</span></code> 标志。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>Integer</p>
</dd>
<dt class="field-odd">有效范围<span class="colon">:</span></dt>
<dd class="field-odd"><p>1 开启， 0 取消</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="noscrub"></span><dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">noscrub</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>设置或取消指定存储池的 <code class="docutils literal notranslate"><span class="pre">NOSCRUB</span></code> 标志。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>Integer</p>
</dd>
<dt class="field-odd">有效范围<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">1</span></code> 设置， <code class="docutils literal notranslate"><span class="pre">0</span></code> 取消</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="nodeep-scrub"></span><dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">nodeep-scrub</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>设置或取消指定存储池的 <code class="docutils literal notranslate"><span class="pre">NODEEP_SCRUB</span></code> 标志。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>Integer</p>
</dd>
<dt class="field-odd">有效范围<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">1</span></code> 开启， <code class="docutils literal notranslate"><span class="pre">0</span></code> 取消</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="target-max-bytes"></span><dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">target_max_bytes</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>启用了已废弃的缓存层功能、且达到 <code class="docutils literal notranslate"><span class="pre">max_bytes</span></code> 阀值时， Ceph 就回写或赶出对象。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>整数</p>
</dd>
<dt class="field-odd">实例<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">1000000000000</span></code>  #1-TB</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="target-max-objects"></span><dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">target_max_objects</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>启用了已废弃的缓存层功能，且达到 <code class="docutils literal notranslate"><span class="pre">max_objects</span></code> 阀值时 Ceph 就回写或赶出对象。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>整数</p>
</dd>
<dt class="field-odd">实例<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">1000000</span></code> #1M objects</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="fast-read"></span><dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">fast_read</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>在纠删码存储池上，如果打开这个标志（ <code class="docutils literal notranslate"><span class="pre">on</span></code> ），读请求会向所有分片发送子操作读
（ sub reads ），然后等着，直到收到的分片足以解码给客户端。
对 <em>jerasure</em> 或 <em>isa</em> 纠删码插件来说，只要前 <em>K</em> 个请求返回，就能立即解码、
并先把这些数据发给客户端。这样有助于资源折衷，以提升性能。此标志只支持纠删码存储池。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>Boolean</p>
</dd>
<dt class="field-odd">默认值<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">0</span></code></p>
</dd>
</dl>
</dd></dl>

<span class="target" id="scrub-min-interval"></span><dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">scrub_min_interval</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>在负载低时，洗刷存储池 PG 的最小间隔秒数。如果是 <code class="docutils literal notranslate"><span class="pre">0</span></code> ，
就按照中央配置库里的 <code class="docutils literal notranslate"><span class="pre">osd_scrub_min_interval</span></code> 执行。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>Double</p>
</dd>
<dt class="field-odd">默认值<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">0</span></code></p>
</dd>
</dl>
</dd></dl>

<span class="target" id="scrub-max-interval"></span><dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">scrub_max_interval</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>不管集群负载如何，都要洗刷存储池 PG 的最大间隔秒数。如果 <code class="docutils literal notranslate"><span class="pre">scrub_max_interval</span></code>
的值是 <code class="docutils literal notranslate"><span class="pre">0</span></code> ，就采用中央配置库里的 <code class="docutils literal notranslate"><span class="pre">osd_scrub_max_interval</span></code> 数值。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>Double</p>
</dd>
<dt class="field-odd">默认值<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">0</span></code></p>
</dd>
</dl>
</dd></dl>

<span class="target" id="deep-scrub-interval"></span><dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">deep_scrub_interval</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>“深度”洗刷存储池 PG 的间隔秒数。如果 <code class="docutils literal notranslate"><span class="pre">deep_scrub_interval</span></code> 的数值是 <code class="docutils literal notranslate"><span class="pre">0</span></code> ，
就采用中央配置库里的 <code class="docutils literal notranslate"><span class="pre">osd_deep_scrub_interval</span></code> 。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>Double</p>
</dd>
<dt class="field-odd">默认值<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">0</span></code></p>
</dd>
</dl>
</dd></dl>

<span class="target" id="recovery-priority"></span><dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">recovery_priority</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>设置此值可调整存储池计算出的保留优先级。此值必须介于 <code class="docutils literal notranslate"><span class="pre">-10</span></code> 到 <code class="docutils literal notranslate"><span class="pre">10</span></code> 之间。
所有分配了负值的存储池，其优先级都会低于所有新存储池，
所以用户应该给低优先级存储池分配负值。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>Integer</p>
</dd>
<dt class="field-odd">默认值<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">0</span></code></p>
</dd>
</dl>
</dd></dl>

<span class="target" id="recovery-op-priority"></span><dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">recovery_op_priority</span></span></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>设置指定存储池 PG 的恢复操作优先级。本选项会覆盖
<a class="reference internal" href="../../configuration/osd-config-ref/#confval-osd_recovery_op_priority"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_recovery_op_priority</span></code></a> 设置的通用优先级。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>Integer</p>
</dd>
<dt class="field-odd">默认值<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">0</span></code></p>
</dd>
</dl>
</dd></dl>

</section>
<section id="id17">
<h2>获取存储池选项值<a class="headerlink" href="#id17" title="Permalink to this heading"></a></h2>
<p>要获取一个存储池选项（ key ）的值，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>get<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span><span class="w"> </span><span class="o">{</span>key<span class="o">}</span></span>
</pre></div></div><p>你可以获取到下列选项的值：</p>
<p><code class="docutils literal notranslate"><span class="pre">size</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#size">size</a></p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>整数</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">min_size</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#min-size">min_size</a></p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>整数</p>
</dd>
<dt class="field-odd">适用版本<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">0.54</span></code> 及以上</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">pg_num</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#pg-num">pg_num</a></p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>整数</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">pgp_num</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#pgp-num">pgp_num</a></p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>整数</p>
</dd>
<dt class="field-odd">有效范围<span class="colon">:</span></dt>
<dd class="field-odd"><p>小于等于 <code class="docutils literal notranslate"><span class="pre">pg_num</span></code> 。</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">crush_rule</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#crush-rule">crush_rule</a></p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">target_max_bytes</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#target-max-bytes">target_max_bytes</a></p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>整数</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">target_max_objects</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#target-max-objects">target_max_objects</a></p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>整数</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">fast_read</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#fast-read">fast_read</a></p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>Boolean</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">scrub_min_interval</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#scrub-min-interval">scrub_min_interval</a></p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>Double</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">scrub_max_interval</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#scrub-max-interval">scrub_max_interval</a></p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>Double</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">deep_scrub_interval</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#deep-scrub-interval">deep_scrub_interval</a></p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>Double</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">allow_ec_overwrites</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#allow-ec-overwrites">allow_ec_overwrites</a></p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>Boolean</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">recovery_priority</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#recovery-priority">recovery_priority</a></p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>Integer</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">recovery_op_priority</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#recovery-op-priority">recovery_op_priority</a></p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>Integer</p>
</dd>
</dl>
</section>
<section id="rados">
<h2>设置 RADOS 对象副本数<a class="headerlink" href="#rados" title="Permalink to this heading"></a></h2>
<p>要设置多副本存储池的对象副本数，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span><span class="nb">set</span><span class="w"> </span><span class="o">{</span>poolname<span class="o">}</span><span class="w"> </span>size<span class="w"> </span><span class="o">{</span>num-replicas<span class="o">}</span></span>
</pre></div></div><div class="admonition important">
<p class="admonition-title">Important</p>
<p><code class="docutils literal notranslate"><span class="pre">{num-replicas}</span></code> 参数包括主对象自身。
例如，如果你想要对象自身及其两份副本共计三份，执行下列命令指定 <code class="docutils literal notranslate"><span class="pre">3</span></code> ：</p>
</div>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span><span class="nb">set</span><span class="w"> </span>data<span class="w"> </span>size<span class="w"> </span><span class="m">3</span></span>
</pre></div></div><p>你可以在每个存储池上执行这个命令。</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>一个处于降级模式的对象，其副本数小于规定值 <code class="docutils literal notranslate"><span class="pre">pool</span> <span class="pre">size</span></code> ，
但仍可接受 I/O 请求。为保证 I/O 正常，
可用 <code class="docutils literal notranslate"><span class="pre">min_size</span></code> 选项为其设置个最低副本数。例如，执行下列命令：</p>
</div>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span><span class="nb">set</span><span class="w"> </span>data<span class="w"> </span>min_size<span class="w"> </span><span class="m">2</span></span>
</pre></div></div><p>此命令可确保数据存储池里任何副本数小于 <code class="docutils literal notranslate"><span class="pre">min_size</span></code> 的对象都不会收到 I/O 了。
注意，在生产环境下设置 <code class="docutils literal notranslate"><span class="pre">size</span></code> 为 <code class="docutils literal notranslate"><span class="pre">2</span></code> 或者 <code class="docutils literal notranslate"><span class="pre">min_size</span></code> 为 <code class="docutils literal notranslate"><span class="pre">1</span></code> 有丢数据的风险，
只有在情况紧急的时候才能这样做，而且只能是临时性的。</p>
</section>
<section id="id18">
<h2>获取对象副本数<a class="headerlink" href="#id18" title="Permalink to this heading"></a></h2>
<p>要获取对象副本数，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>dump<span class="w"> </span><span class="p">|</span><span class="w"> </span>grep<span class="w"> </span><span class="s1">&#39;replicated size&#39;</span></span>
</pre></div></div><p>Ceph 会列出存储池，且高亮 <code class="docutils literal notranslate"><span class="pre">replicated</span> <span class="pre">size</span></code> 属性。默认情况下，
Ceph 会维持三个副本或复制品，也就是 size 值为 <code class="docutils literal notranslate"><span class="pre">3</span></code> 。</p>
</section>
<section id="id19">
<h2>管理加了 <code class="docutils literal notranslate"><span class="pre">--bulk</span></code> 标记的存储池<a class="headerlink" href="#id19" title="Permalink to this heading"></a></h2>
<p>见 <a class="reference internal" href="../placement-groups/#managing-bulk-flagged-pools"><span class="std std-ref">管理带有 bulk 标志的存储池</span></a> 。</p>
</section>
<section id="stretch">
<h2>配置 stretch 存储池的值<a class="headerlink" href="#stretch" title="Permalink to this heading"></a></h2>
<p>要配置 stretch 存储池的值，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>stretch<span class="w"> </span><span class="nb">set</span><span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span><span class="w"> </span><span class="o">{</span>peering_crush_bucket_count<span class="o">}</span><span class="w"> </span><span class="o">{</span>peering_crush_bucket_target<span class="o">}</span><span class="w"> </span><span class="o">{</span>peering_crush_bucket_barrier<span class="o">}</span><span class="w"> </span><span class="o">{</span>crush_rule<span class="o">}</span><span class="w"> </span><span class="o">{</span>size<span class="o">}</span><span class="w"> </span><span class="o">{</span>min_size<span class="o">}</span><span class="w"> </span><span class="o">[</span>--yes-i-really-mean-it<span class="o">]</span></span>
</pre></div></div><p>以下是参数解析：</p>
<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">{pool-name}</span></span></dt>
<dd><p>此存储池的名字。它必须是存在的存储池，此命令不会创建一个新存储池。</p>
<dl class="field-list simple">
<dt class="field-odd">类型<span class="colon">:</span></dt>
<dd class="field-odd"><p>String</p>
</dd>
<dt class="field-even">是否必需<span class="colon">:</span></dt>
<dd class="field-even"><p>Yes.</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">{peering_crush_bucket_count}</span></span></dt>
<dd><p>此值与 <code class="docutils literal notranslate"><span class="pre">peering_crush_bucket_barrier</span></code> 一起使用，
可以决定选定的 acting set 内的一组 OSD 是否能相互建立对等互联，
根据的是 actine set 中不同桶的数量。</p>
<dl class="field-list simple">
<dt class="field-odd">类型<span class="colon">:</span></dt>
<dd class="field-odd"><p>Integer</p>
</dd>
<dt class="field-even">是否必需<span class="colon">:</span></dt>
<dd class="field-even"><p>Yes.</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">{peering_crush_bucket_target}</span></span></dt>
<dd><p>此值与 <code class="docutils literal notranslate"><span class="pre">peering_crush_bucket_barrier</span></code> 和 <code class="docutils literal notranslate"><span class="pre">size</span></code> 一起用于计算 <code class="docutils literal notranslate"><span class="pre">bucket_max</span></code> 值，
这个值限制着同一个桶内被选入 PG actine set 的 OSD 数量。</p>
<dl class="field-list simple">
<dt class="field-odd">类型<span class="colon">:</span></dt>
<dd class="field-odd"><p>Integer</p>
</dd>
<dt class="field-even">是否必需<span class="colon">:</span></dt>
<dd class="field-even"><p>Yes.</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">{peering_crush_bucket_barrier}</span></span></dt>
<dd><p>一个存储池能跨越的桶类型，例如 rack 、 row 、 datacenter 。</p>
<dl class="field-list simple">
<dt class="field-odd">类型<span class="colon">:</span></dt>
<dd class="field-odd"><p>String</p>
</dd>
<dt class="field-even">是否必需<span class="colon">:</span></dt>
<dd class="field-even"><p>Yes.</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">{crush_rule}</span></span></dt>
<dd><p>stretch 存储池所用的 crush 规则。存储池类型和 crush_rule 类型必须相匹配（replicated 或 erasure ）。</p>
<dl class="field-list simple">
<dt class="field-odd">类型<span class="colon">:</span></dt>
<dd class="field-odd"><p>String</p>
</dd>
<dt class="field-even">是否必需<span class="colon">:</span></dt>
<dd class="field-even"><p>Yes.</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">{size}</span></span></dt>
<dd><p>stretch 存储池内的对象副本数。</p>
<dl class="field-list simple">
<dt class="field-odd">类型<span class="colon">:</span></dt>
<dd class="field-odd"><p>Integer</p>
</dd>
<dt class="field-even">是否必需<span class="colon">:</span></dt>
<dd class="field-even"><p>Yes.</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">{min_size}</span></span></dt>
<dd><p>stretch 存储池维持正常 I/O 操作所需的最低副本数。</p>
<dl class="field-list simple">
<dt class="field-odd">类型<span class="colon">:</span></dt>
<dd class="field-odd"><p>Integer</p>
</dd>
<dt class="field-even">是否必需<span class="colon">:</span></dt>
<dd class="field-even"><p>Yes.</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">{--yes-i-really-mean-it}</span></span></dt>
<dd><p>需要使用该标记来确认您是否真的想绕过安全检查并为某个 stretch 存储池设置值，
例如，当你试图把 <code class="docutils literal notranslate"><span class="pre">peering_crush_bucket_count</span></code> 或 <code class="docutils literal notranslate"><span class="pre">peering_crush_bucket_target</span></code>
设置为大于 crush 图中的桶数量时。</p>
<dl class="field-list simple">
<dt class="field-odd">类型<span class="colon">:</span></dt>
<dd class="field-odd"><p>Flag</p>
</dd>
<dt class="field-even">是否必需<span class="colon">:</span></dt>
<dd class="field-even"><p>No.</p>
</dd>
</dl>
</dd></dl>

</section>
<section id="setting-values-for-a-stretch-pool">
<span id="id20"></span><h2>取消给 stretch 存储池设置的值<a class="headerlink" href="#setting-values-for-a-stretch-pool" title="Permalink to this heading"></a></h2>
<p>要把存储池恢复回非 stretch 状态时，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>stretch<span class="w"> </span><span class="nb">unset</span><span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span></span>
</pre></div></div><p>以下是参数解析：</p>
<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">{pool-name}</span></span></dt>
<dd><p>存储池的名字。它必须是存在的存储池且为 stretch 模式，
就是说，它必须是已经用 <cite>ceph osd pool stretch set</cite> 命令设置过的。</p>
<dl class="field-list simple">
<dt class="field-odd">类型<span class="colon">:</span></dt>
<dd class="field-odd"><p>String</p>
</dd>
<dt class="field-even">是否必需<span class="colon">:</span></dt>
<dd class="field-even"><p>Yes.</p>
</dd>
</dl>
</dd></dl>

</section>
<section id="id21">
<h2>显示一个 stretch 存储池设置的值<a class="headerlink" href="#id21" title="Permalink to this heading"></a></h2>
<p>要显示一个 stretch 存储池的值，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>stretch<span class="w"> </span>show<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span></span>
</pre></div></div><p>以下是参数解析：</p>
<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">{pool-name}</span></span></dt>
<dd><p>存储池的名字。它必须是存在的存储池且为 stretch 模式，
就是说，它必须是已经用 <cite>ceph osd pool stretch set</cite> 命令设置过的。</p>
<dl class="field-list simple">
<dt class="field-odd">类型<span class="colon">:</span></dt>
<dd class="field-odd"><p>String</p>
</dd>
<dt class="field-even">是否必需<span class="colon">:</span></dt>
<dd class="field-even"><p>Yes.</p>
</dd>
</dl>
</dd></dl>

</section>
</section>



<div id="support-the-ceph-foundation" class="admonition note">
  <p class="first admonition-title">Brought to you by the Ceph Foundation</p>
  <p class="last">The Ceph Documentation is a community resource funded and hosted by the non-profit <a href="https://ceph.io/en/foundation/">Ceph Foundation</a>. If you would like to support this and our other efforts, please consider <a href="https://ceph.io/en/foundation/join/">joining now</a>.</p>
</div>


           </div>
           
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="../data-placement/" class="btn btn-neutral float-left" title="数据归置概览" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="../erasure-code/" class="btn btn-neutral float-right" title="纠删码" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).</p>
  </div>

   

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>